
/**
 * 新增一个需要改变元素的div的id
 * @param $p
 * @param $dom
 */
function openAdvanced($p, $dom){
	var $collapsablePanel = $("#collapsablePanel", $p);
	if ($collapsablePanel.is(':animated')) {
		return false;
	}
	var $advancedQuery = $('.searchBar li.advancedQuery:first', $p), 
		$gridPart = $(".grid", $p), 
		
		$gridBody = $dom?$("div#"+$dom, $p):$(".gridScroller", $p), 
		speed = 400, 
		gridLayoutH = parseInt($gridBody.attr('layoutH')), 
		advancedHeight = 7 + $('.searchContent', $collapsablePanel).length * 29 + 15;
	if ($collapsablePanel.is(':visible')) {
		$("#advancedStatus", $p).val("close");
		$collapsablePanel.prev('.divider').hide();
		$collapsablePanel.slideUp(speed, function(){
			$advancedQuery.removeClass('expand');
		});
		$gridBody.attr('layoutH', gridLayoutH - advancedHeight).height($gridBody.height() + 6).show()
		.animate({height: $gridBody.height() + advancedHeight - 6}, speed);
	} else {
		if ($collapsablePanel.prev('.divider').length == 0) {
			$collapsablePanel.before("<div id='panelDivider' class='divider' style='margin: 0 10px' />");
		}
		$("#advancedStatus", $p).val("open");
		$collapsablePanel.prev('.divider').show();
		$collapsablePanel.slideDown(speed, function(){
			$advancedQuery.addClass('expand');
		});
		$gridBody.attr('layoutH', gridLayoutH + advancedHeight).height($gridBody.height() - 7).show()
		.animate({height: $gridBody.height() - advancedHeight + 7}, speed);
	}
}

/**
 * 新增一个需要改变元素的div的id
 * @param $p
 * @param $dom
 */
function initAdvancedQuery($p, $dom)
{
var status = $("#advancedStatus", $p).val();
if(status=="open")
{
	var collapsablePanel=$("#collapsablePanel", $p);
	collapsablePanel.before("<div id='panelDivider' class='divider' style='margin: 0 10px;'></div>");
	collapsablePanel.css("display","block");
	
	var gridHeight = $dom? $("div#"+$dom, $p).attr("layoutH"): $(".table", $p).attr("layoutH");
	
	var panlHeight=$("#collapsablePanel", $p).height();
	gridHeight=parseInt(gridHeight)+parseInt(panlHeight)+16;
	if($dom){
		$("div#"+$dom, $p).attr("layoutH",gridHeight);
	}else{
		$(".table", $p).attr("layoutH",gridHeight);
	}
	$('.searchBar li.advancedQuery:first', $p).addClass('expand');
}
}